using TMPro;
using UnityEngine;
using UnityEngine.UI;

//金币UI显示
public class CoinUI : MonoBehaviour
{
    public TextMeshProUGUI coinText;
    
    // 注册事件监听器
    private void OnEnable()
    {
        PlayerEvents.onUpdateCoin += UpdateCoin;
    }

    // 注销事件监听器
    private void OnDisable()
    {
        PlayerEvents.onUpdateCoin -= UpdateCoin;
    }

    public void UpdateCoin(int CoinCount){
        coinText.text = CoinCount.ToString();
    }

}

